package com.h3c.ptability.client;

import com.alibaba.fastjson.JSONObject;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(name = "hr-performance", url = "${eos.orgbaseinfo.url}")
public interface DataCenterFeignClient {
    /**
     * 同步所有正式员工信息
     *
     * @param Authorization
     * @return
     * 出参示例：
     * {
     *             "dept_code": "50043452",
     *             "end_date": null,
     *             "emp_code": "00016",
     *             "operate_type": "01",
     *             "post_categories_1": null,
     *             "emp_name": "邹兴珠",
     *             "position_name": "测试职位1",
     *             "dept3_code": null,
     *             "display_name": "zouxingzhu",
     *             "dept1_code": "50043589",
     *             "entry_date": "2020-01-01",
     *             "plevel": "016",
     *             "position_level": "MP11",
     *             "post_code": "52031526",
     *             "dept_manager_id": "lvlaura 63758",
     *             "domain_account": "z00016",
     *             "zlevel": null,
     *             "dept2_code": "50043452",
     *             "position_type": "管理-专业",
     *             "email": "zouxingzhu@h3c.com"
     *         },
     *
     */
    @GetMapping(value = "views/inventory_emps", consumes = {"application/json"}, headers = {"Authorization={Authorization}"})
    String queryAllWorkers(@RequestParam("Authorization") String Authorization);

    @GetMapping(value = "views/performance_manager_all", consumes = {"application/json"}, headers = {"Authorization={Authorization}"})
    String queryDeptLeaders(@RequestParam("Authorization") String Authorization);

    /**
     * 同步公司所有部门信息
     *
     * @param Authorization
     * @return
     * {
     *     "flag": true,
     *     "code": 20216,
     *     "message": "查询成功",
     *     "traceId": "00342cf8b95ad5180a40aa9e38ad44b6",
     *     "data": [
     *         {
     *             "dept_code": "50043812",
     *             "type_id": "RD",
     *             "dept_name": "软件&IT产品资料部",
     *             "dept_code_chain": "50040000/50040248/50041417/50043812",
     *             "dept_level": "3",
     *             "coa": "080507",
     *             "sup_dept_code": "50041417",
     *             "dept_type": "研发",
     *             "dept_enname": "Software & IT Pro.Info. Dev.",
     *             "coa_des": "软件&IT产品资料部",
     *             "coa_des_en": "Software & IT Product Information Development Dept, TIDD",
     *             "dept_name_chain": "新华三/研究开发部/资料开发部/软件&IT产品资料部",
     *             "is_display": "1"
     *         },
     */
    @GetMapping(value = "views/inventory_depts", consumes = {"application/json"}, headers = {"Authorization={Authorization}"})
    JSONObject queryAllDept(@RequestParam("Authorization") String Authorization);

    /**
     * 根据域账号查询登录人工号姓名邮箱
     *
     * @param str 域账号
     * @param Authorization
     * @return
     */
    @PostMapping(value = "views/inventory_empcode", consumes = {"application/json"}, headers = {"Authorization={Authorization}"})
    JSONObject queryLoginUserInfo(@RequestBody String str, @RequestParam("Authorization") String Authorization);

    /**
     * 根据工号 和 统计月份 查询盘点对象基本信息
     *
     * @param str      上个月月份，比如2020-07；因为中台那边的数据是按月同步的，他们需要知道我们想查询哪个月份的数据
     * @param str       盘点对象工号列表：比如 ["00046","01973","00185"]
     * @param Authorization
     * @return
     */
    @PostMapping(value = "views/inventory_emp_label", consumes = {"application/json"}, headers = {"Authorization={Authorization}"})
    String queryPmWorkerInfo(@RequestBody String str, @RequestParam("Authorization") String Authorization);

    /**
     * 根据 季度列表和工号列表，查询指定工号盘点对象的各个季度的绩效成绩
     *
     * @param str        季度列表：需要查询哪几个季度的数据，比如 ["2018Q2","2018Q1"]
     * @param str      工号列表： 比如 ["00046","01973","00185"]
     * @param Authorization
     * @return
     */
    @PostMapping(value = "views/inventory_emp_grade", consumes = {"application/json"}, headers = {"Authorization={Authorization}"})
    String queryPdWorkerGrade(@RequestBody String str, @RequestParam("Authorization") String Authorization);


    /**
     * 查询盘点对象的领航者文化评分
     *
     * @str empCode       盘点对象工号列表
     * @str begDate       查询领航者评分季度的开始日期 2020-01-01
     * @str endDate       查询领航者评分季度的结束日期的下一天 ；比如从 2020-01-01 到 2020-07-01 查询的是2020前两季度的评分。
     * @param Authorization
     * @return
     */
    @PostMapping(value = "views/inventory_emp_cultura", consumes = {"application/json"}, headers = {"Authorization={Authorization}"})
    String queryWorkerCultura(@RequestBody String str, @RequestParam("Authorization") String Authorization);

    /**
     * 查询盘点对象的领航者文化评分
     *
     * @str empCode       盘点对象工号列表
     * @str begDate       查询领航者评分季度的开始日期 2020-01-01
     * @str endDate       查询领航者评分季度的结束日期的下一天 ；比如从 2020-01-01 到 2020-07-01 查询的是2020前两季度的评分。
     * @param Authorization
     * @return
     */
    @PostMapping(value = "views/performance_imsge", consumes = {"application/json"}, headers = {"Authorization={Authorization}"})
    JSONObject queryWorkerPortrait(@RequestBody String str, @RequestParam("Authorization") String Authorization);

    /**
     * 同步指定季度范围内所有员工的休假记录，绩效系统自己进行休假天数计算
     *
     *  {
     *     "startDate":"20190101",
     *     "endDate":"20191231"
     * }
     * @param Authorization
     * @return
     */
    @PostMapping(value = "views/performance_leave", consumes = {"application/json"}, headers = {"Authorization={Authorization}"})
    String syncLeaveRecord(@RequestBody String str, @RequestParam("Authorization") String Authorization);

    /**
     * 同步指定季度范围内所有员工的惩处信息
     *
     {
     "startTime":"2019-01-01",
     "endTime":"2019-12-31"
     }
     * @param Authorization
     * @return
     */
    @PostMapping(value = "views/performance_punishment", consumes = {"application/json"}, headers = {"Authorization={Authorization}"})
    JSONObject syncPunishRecord(@RequestBody String str, @RequestParam("Authorization") String Authorization);

    /**
     *获取合同信息，绩效系统
     *
     * @str str       盘点对象工号列表
     * @param Authorization
     * @return
     */
    @PostMapping(value = "views/performance_contract", consumes = {"application/json"}, headers = {"Authorization={Authorization}"})
    JSONObject syncContract(@RequestBody String str, @RequestParam("Authorization") String Authorization);

    /**
     *根据合作员工工号 查询合作员工的工号，姓名，域账号，1到3级部门id,直属部门ID，邮箱。
     *
     * @str str       工号
     * @param Authorization
     * @return
     */
    @PostMapping(value = "views/per_emp_parter", consumes = {"application/json"}, headers = {"Authorization={Authorization}"})
    String queryCooperativeWorker(@RequestBody String str, @RequestParam("Authorization") String Authorization);

    /**
     *根据员工工号 查询员工的工号，姓名，手机，邮箱等基本信息。
     *
     * @str str       工号
     * @param Authorization
     * @return
     */
    @PostMapping(value = "views/hrssc_emps", consumes = {"application/json"}, headers = {"Authorization=Bearer {Authorization}"})
    String queryWorkerBasicInfo(@RequestBody String str, @RequestParam("Authorization") String Authorization);

    /**
     * 员工头像
     * @param str
     * @param Authorization
     * @return
     */
    @PostMapping(value = "views/performance_image", consumes = {"application/json"}, headers = {"Authorization={Authorization}"})
    JSONObject getWorkerPortrait(@RequestBody String str, @RequestParam("Authorization") String Authorization);


}